package com.itheima.d2_string.demo;

import java.util.Scanner;

public class StringTest {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        for(int i = 0; i < 3; i++){
            System.out.println("请输入用户名：");
            String userName = sc.next();
            System.out.println("请输入登录的密码：");
            String password = sc.next();
            //调用登录方法，判断是否登录成功
            boolean rs = login(userName,password);
            if(rs){
                System.out.println("成功进入系统");
                break;
            }
            System.out.println("您输入的用户名或密码有误，请重新输入");

        }
    }
    public static boolean login(String username, String password){
        String okUsername = "itheima";
        String okPassword = "123456";
        return  username.equals(okUsername) && password.equals(okPassword);
    }
}
